Type Error Customization in GHC (DRAFT)
نویسندگان
چکیده
Abstract Embedded domain specic languages (DSLs) are a common paern in the functional programming world, providing very high-level abstractions to programmer. Unfortunately, this abstraction is broken when type errors occur, leaking details of the DSL implementation. In this paper we present a set of techniques for customizing type error diagnosis in order to avoid this leaking. ese techniques have been implemented in the GHC Haskell compiler. Our customizations are declared in the type signatures of functions provided by the DSL, leading to type error message that are context-dependent: the same kind of error can be reported in a dierent way depending on the particular expression in which it occurs. We make use of the ability to manipulate constraints using type-level programming which is already present in GHC, and which enables reuse and abstraction of common type error paerns.
منابع مشابه
Injective Type Families for Haskell (extended version)
Haskell, as implemented by the Glasgow Haskell Compiler (GHC), allows expressive type-level programming. The most popular typelevel programming extension is TypeFamilies , which allows users to write functions on types. Yet, using type functions can cripple type inference in certain situations. In particular, lack of injectivity in type functions means that GHC can never infer an instantiation ...
متن کاملInjective Type Families for Haskell ( extended version ) 1
Haskell, as implemented by the Glasgow Haskell Compiler (GHC), allows expressive type-level programming. The most popular typelevel programming extension is TypeFamilies , which allows users to write functions on types. Yet, using type functions can cripple type inference in certain situations. In particular, lack of injectivity in type functions means that GHC can never infer an instantiation ...
متن کاملAn overabundance of equality: Implementing kind equalities into Haskell
Haskell, as embodied by version 7.10.1 of the Glasgow Haskell Compiler (GHC), supports reasoning about equality among types, via generalized algebraic datatypes (GADTs) and type families. However, these features are not available among the kinds that classify the types. Motivated by a concrete example of how kind equalities can help programmers today, this paper presents the challenges and solu...
متن کاملAn overabundance of equality : Implementing kind equalities into Haskell ( Extended version )
Haskell, as embodied by version 7.10.1 of the Glasgow Haskell Compiler (GHC), supports reasoning about equality among types, via generalized algebraic datatypes (GADTs) and type families. However, these features are not available among the kinds that classify the types. Motivated by a concrete example of how kind equalities can help programmers today, this paper presents the challenges and solu...
متن کاملThesis Proposal (Draft)
The goal of my thesis project is to create a framework for encoding and reasoning about functional languages in the Isabelle theorem prover. The framework will encode languages using deep embeddings, with higher-order abstract syntax. The motivating test case is the GHCCore language—an explicitly-typed, desugared variant of Haskell which is used as an intermediate language by the Glasgow Haskel...
متن کامل